import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '平台ID',
    align: "center",
    dataIndex: 'platformId'
  },
  {
    title: '用户',
    align: "center",
    dataIndex: 'userId'
  },
  {
    title: '名称',
    align: "center",
    dataIndex: 'title'
  },
  {
    title: '图片',
    align: "center",
    dataIndex: 'imageUrl',
    customRender: render.renderImage,
  },
  {
    title: '是否登录',
    align: "center",
    dataIndex: 'isLogin'
  },
  {
    title: '账号',
    align: "center",
    dataIndex: 'account'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'start'
  },
  {
    title: '是否有待办',
    align: "center",
    dataIndex: 'hasTips'
  },
  {
    title: '内容',
    align: "center",
    dataIndex: 'messag'
  },
  {
    title: 'Token',
    align: "center",
    dataIndex: 'token'
  },
  {
    title: '登录账号',
    align: "center",
    dataIndex: 'userName'
  },
  {
    title: '登录密码',
    align: "center",
    dataIndex: 'userPassord'
  },
  {
    title: '重试次数',
    align: "center",
    dataIndex: 'retryCount'
  },
  {
    title: '参数',
    align: "center",
    dataIndex: 'params'
  },
  {
    title: '接任务时间戳',
    align: "center",
    dataIndex: 'taskTime'
  },
  {
    title: 'Cookie',
    align: "center",
    dataIndex: 'cookie'
  },
  {
    title: 'localStorage',
    align: "center",
    dataIndex: 'localStorage'
  },
  {
    title: '创建日期',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '更新日期',
    align: "center",
    dataIndex: 'updateTime'
  },

];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "平台ID",
    field: 'platformId',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "用户",
    field: 'userId',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "名称",
    field: 'title',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "是否登录",
    field: 'isLogin',
    component: 'InputNumber',
    //colProps: {span: 6},
  },
  {
    label: "账号",
    field: 'account',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "状态",
    field: 'start',
    component: 'InputNumber',
    //colProps: {span: 6},
  },
  {
    label: "创建日期",
    field: 'createTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    //colProps: {span: 6},
  },
  {
    label: "更新日期",
    field: 'updateTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    //colProps: {span: 6},
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '平台ID',
    field: 'platformId',
    component: 'Input',
  },
  {
    label: '用户',
    field: 'userId',
    component: 'Input',
  },
  {
    label: '名称',
    field: 'title',
    component: 'Input',
  },
  {
    label: '图片',
    field: 'imageUrl',
    component: 'JImageUpload',
    componentProps: {
      fileMax: 0
    },
  },
  {
    label: '是否登录',
    field: 'isLogin',
    component: 'InputNumber',
  },
  {
    label: '账号',
    field: 'account',
    component: 'Input',
  },
  {
    label: '状态',
    field: 'start',
    component: 'InputNumber',
  },
  {
    label: '是否有待办',
    field: 'hasTips',
    component: 'Input',
  },
  {
    label: '内容',
    field: 'messag',
    component: 'Input',
  },
  {
    label: 'Token',
    field: 'token',
    component: 'Input',
  },
  {
    label: '登录账号',
    field: 'userName',
    component: 'Input',
  },
  {
    label: '登录密码',
    field: 'userPassord',
    component: 'Input',
  },
  {
    label: '重试次数',
    field: 'retryCount',
    component: 'InputNumber',
  },
  {
    label: '参数',
    field: 'params',
    component: 'Input',
  },
  {
    label: '接任务时间戳',
    field: 'taskTime',
    component: 'InputNumber',
  },
  {
    label: 'Cookie',
    field: 'cookie',
    component: 'Input',
  },
  {
    label: 'localStorage',
    field: 'localStorage',
    component: 'Input',
  },
  {
    label: '创建日期',
    field: 'createTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicDisabled: true
  },
  {
    label: '更新日期',
    field: 'updateTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicDisabled: true
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

// 高级查询数据
export const superQuerySchema = {
  platformId: { title: '平台ID', order: 0, view: 'text', type: 'string', },
  userId: { title: '用户', order: 1, view: 'text', type: 'string', },
  title: { title: '名称', order: 2, view: 'text', type: 'string', },
  imageUrl: { title: '图片', order: 3, view: 'image', type: 'string', },
  isLogin: { title: '是否登录', order: 4, view: 'number', type: 'number', },
  account: { title: '账号', order: 5, view: 'text', type: 'string', },
  start: { title: '状态', order: 6, view: 'number', type: 'number', },
  hasTips: { title: '是否有待办', order: 7, view: 'text', type: 'string', },
  messag: { title: '内容', order: 8, view: 'text', type: 'string', },
  token: { title: 'Token', order: 9, view: 'text', type: 'string', },
  userName: { title: '登录账号', order: 10, view: 'text', type: 'string', },
  userPassord: { title: '登录密码', order: 11, view: 'text', type: 'string', },
  retryCount: { title: '重试次数', order: 12, view: 'number', type: 'number', },
  params: { title: '参数', order: 13, view: 'text', type: 'string', },
  taskTime: { title: '接任务时间戳', order: 14, view: 'number', type: 'number', },
  cookie: { title: 'Cookie', order: 15, view: 'text', type: 'string', },
  localStorage: { title: 'localStorage', order: 16, view: 'text', type: 'string', },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}